import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; 
import axios from 'axios'

import 'assets/css/global.css'      //全局CSS
import 'assets/fonts/iconfont.css'  //字体图标
//element-ui并没提供树形表格  所以我们下载第三方插件 通过 npm i vue-table-with-tree-grid -S
import TreeTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器及样式
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
//npm install echarts --save 和导入echarts
import * as echarts from 'echarts'
//顶部加载进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

Vue.prototype.$echarts = echarts
Vue.prototype.$http = axios       //每个文件都能通过$http拿到axios  封装方式见supermall
axios.defaults.baseURL = 'http://www.ysqorz.top:8888/api/private/v1'
                        //http://127.0.0.1:8888/api/private/v1
                        //http://www.ysqorz.top:8888/api/private/v1
//在request拦截器中 展示进度条Nprogress.start()                    
axios.interceptors.request.use(config => {  //请求拦截 
  // console.log(config);       //请求有权限的页面都会在header的Authorization带上token
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})              
//在response拦截器中 隐藏进度条Nprogress.done()   
axios.interceptors.response.use(config => {  //响应拦截
  NProgress.done()
  return config
})            

Vue.use(ElementUI); 
Vue.use(VueQuillEditor)
Vue.component('tree-table', TreeTable);
Vue.config.productionTip = false


new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
